
import  React,{ Suspense}from "react"
import { createBrowserRouter, Navigate}  from "react-router-dom"


const  App= React.lazy(()=>import("../App"))
const  Login= React.lazy(()=>import("../page/Login/Login"))
const  My= React.lazy(()=>import("../page/My/My"))
const  Cart= React.lazy(()=>import("../page/Cart/Cart"))
const  Publish= React.lazy(()=>import("../page/publish/Publish"))
const  Message= React.lazy(()=>import("../page/Message/Message"))
const  Shou= React.lazy(()=>import("../page/shou/Shou"))
const Zhu = React.lazy(()=>import("../page/Login/Zhu"))
const Xiu = React.lazy(()=>import("../page/My/Xiu"))
const Dingdan = React.lazy(()=>import('../page/Cart/Dingdan'))

const Detail = React.lazy(()=>import("../page/shou/Detail"))
const So = React.lazy(()=>import("../page/shou/So"))
const Result = React.lazy(()=>import("../page/shou/SearchResult"))
const History = React.lazy(()=>import("../page/My/History"))
const Collect = React.lazy(()=>import("../page/My/Collect"))
const Address = React.lazy(()=>import("../page/My/Address"))
const Mai = React.lazy(()=>import("../page/My/Mai"))
const Kefu = React.lazy(()=>import("../page/My/Ke"))
const Setup = React.lazy(()=>import("../page/My/Setup"))
const Sell = React.lazy(()=>import("../page/My/Sell"))
const Bought = React.lazy(()=>import("../page/My/Bought"))


//
// const Islogin=(zu)=>{

//     let Com  =  zu.children.type  
//     console.log(Com);
//     return  sessionStorage.getItem("token")?<Com></Com>: <Navigate to="/login"></Navigate>


// }
const router =  createBrowserRouter([
    {path:"/",element:<App></App>,children:[
        {path:"/my",element:<My></My>},
        {path:"/cart",element:<Cart></Cart>},
        {path:"/publish",element:<Publish></Publish>},
        {path:"/message",element:<Message></Message>},
        {path:"/shou",element:<Shou></Shou>},
        {path:"/history",element:<History></History>},
        {path:"/collect",element:<Collect></Collect>},
        {path:"/address",element:<Address></Address>}

    ]},
    {path:"/login",element:<Login></Login>},
    {path:"/zhu",element:<Zhu></Zhu>},
    {path:"/xiu",element:<Xiu></Xiu>},
    {path:"/detail/:id",element:<Detail></Detail>},
    {path:"/so",element:<So></So>},
    {path:"/result",element:<Result></Result>},
    {path:"/history",element:<History></History>},
    {path:"/collect",element:<Collect></Collect>},
    {path:"/mai",element:<Mai></Mai>},
    {path:"/kefu",element:<Kefu></Kefu>},
    {path:"/setup",element:<Setup></Setup>},
    {path:"/sell",element:<Sell></Sell>},
    {path:"/bought",element:<Bought></Bought>},
    {path:'/dingdan',element:<Dingdan></Dingdan>}

])

export  default  router